var FoodTypeModel = require('../models').FoodType;

module.exports = {
    addFoodType : addFoodType,
    getFoodTypeByFoodTypeId:getFoodTypeByFoodTypeId,
    getFoodTypeByFoodTypeName:getFoodTypeByFoodTypeName,
    getAllFoodType:getAllFoodType
}

function addFoodType(foodTypeName,callback) {
    var foodType = new FoodTypeModel();
    foodType.name = foodTypeName;
    foodType.save(callback);
}

function getFoodTypeByFoodTypeId(foodTypeId, callback) {
    FoodTypeModel.findOne({foodType_id:foodTypeId},callback);
}


function getFoodTypeByFoodTypeName(foodTypeName, callback) {
    FoodTypeModel.findOne({name:foodTypeName},callback);
}

function getAllFoodType(callback) {
    FoodTypeModel.find({},callback);
}